# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Solar.V1.Model.SolarPotential do
  @moduledoc """
  Information about the solar potential of a building. A number of fields in this are defined in terms of "panels". The fields panel_capacity_watts, panel_height_meters, and panel_width_meters describe the parameters of the model of panel used in these calculations.

  ## Attributes

  *   `buildingStats` (*type:* `GoogleApi.Solar.V1.Model.SizeAndSunshineStats.t`, *default:* `nil`) - Size and sunlight quantiles for the entire building, including parts of the roof that were not assigned to some roof segment. Because the orientations of these parts are not well characterised, the roof area estimate is unreliable, but the ground area estimate is reliable. It may be that a more reliable whole building roof area can be obtained by scaling the roof area from whole_roof_stats by the ratio of the ground areas of `building_stats` and `whole_roof_stats`.
  *   `carbonOffsetFactorKgPerMwh` (*type:* `number()`, *default:* `nil`) - Equivalent amount of CO2 produced per MWh of grid electricity. This is a measure of the carbon intensity of grid electricity displaced by solar electricity.
  *   `financialAnalyses` (*type:* `list(GoogleApi.Solar.V1.Model.FinancialAnalysis.t)`, *default:* `nil`) - A FinancialAnalysis gives the savings from going solar assuming a given monthly bill and a given electricity provider. They are in order of increasing order of monthly bill amount. This field will be empty for buildings in areas for which the Solar API does not have enough information to perform financial computations.
  *   `maxArrayAreaMeters2` (*type:* `number()`, *default:* `nil`) - Size, in square meters, of the maximum array.
  *   `maxArrayPanelsCount` (*type:* `integer()`, *default:* `nil`) - Size of the maximum array - that is, the maximum number of panels that can fit on the roof.
  *   `maxSunshineHoursPerYear` (*type:* `number()`, *default:* `nil`) - Maximum number of sunshine hours received per year, by any point on the roof. Sunshine hours are a measure of the total amount of insolation (energy) received per year. 1 sunshine hour = 1 kWh per kW (where kW refers to kW of capacity under Standard Testing Conditions).
  *   `panelCapacityWatts` (*type:* `number()`, *default:* `nil`) - Capacity, in watts, of the panel used in the calculations.
  *   `panelHeightMeters` (*type:* `number()`, *default:* `nil`) - Height, in meters in portrait orientation, of the panel used in the calculations.
  *   `panelLifetimeYears` (*type:* `integer()`, *default:* `nil`) - The expected lifetime, in years, of the solar panels. This is used in the financial calculations.
  *   `panelWidthMeters` (*type:* `number()`, *default:* `nil`) - Width, in meters in portrait orientation, of the panel used in the calculations.
  *   `roofSegmentStats` (*type:* `list(GoogleApi.Solar.V1.Model.RoofSegmentSizeAndSunshineStats.t)`, *default:* `nil`) - Size and sunlight quantiles for each roof segment.
  *   `solarPanelConfigs` (*type:* `list(GoogleApi.Solar.V1.Model.SolarPanelConfig.t)`, *default:* `nil`) - Each SolarPanelConfig describes a different arrangement of solar panels on the roof. They are in order of increasing number of panels. The `SolarPanelConfig` with panels_count=N is based on the first N panels in the `solar_panels` list. This field is only populated if at least 4 panels can fit on a roof.
  *   `solarPanels` (*type:* `list(GoogleApi.Solar.V1.Model.SolarPanel.t)`, *default:* `nil`) - Each SolarPanel describes a single solar panel. They are listed in the order that the panel layout algorithm placed this. This is usually, though not always, in decreasing order of annual energy production.
  *   `wholeRoofStats` (*type:* `GoogleApi.Solar.V1.Model.SizeAndSunshineStats.t`, *default:* `nil`) - Total size and sunlight quantiles for the part of the roof that was assigned to some roof segment. Despite the name, this may not include the entire building. See building_stats.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :buildingStats => GoogleApi.Solar.V1.Model.SizeAndSunshineStats.t() | nil,
          :carbonOffsetFactorKgPerMwh => number() | nil,
          :financialAnalyses => list(GoogleApi.Solar.V1.Model.FinancialAnalysis.t()) | nil,
          :maxArrayAreaMeters2 => number() | nil,
          :maxArrayPanelsCount => integer() | nil,
          :maxSunshineHoursPerYear => number() | nil,
          :panelCapacityWatts => number() | nil,
          :panelHeightMeters => number() | nil,
          :panelLifetimeYears => integer() | nil,
          :panelWidthMeters => number() | nil,
          :roofSegmentStats =>
            list(GoogleApi.Solar.V1.Model.RoofSegmentSizeAndSunshineStats.t()) | nil,
          :solarPanelConfigs => list(GoogleApi.Solar.V1.Model.SolarPanelConfig.t()) | nil,
          :solarPanels => list(GoogleApi.Solar.V1.Model.SolarPanel.t()) | nil,
          :wholeRoofStats => GoogleApi.Solar.V1.Model.SizeAndSunshineStats.t() | nil
        }

  field(:buildingStats, as: GoogleApi.Solar.V1.Model.SizeAndSunshineStats)
  field(:carbonOffsetFactorKgPerMwh)
  field(:financialAnalyses, as: GoogleApi.Solar.V1.Model.FinancialAnalysis, type: :list)
  field(:maxArrayAreaMeters2)
  field(:maxArrayPanelsCount)
  field(:maxSunshineHoursPerYear)
  field(:panelCapacityWatts)
  field(:panelHeightMeters)
  field(:panelLifetimeYears)
  field(:panelWidthMeters)

  field(:roofSegmentStats,
    as: GoogleApi.Solar.V1.Model.RoofSegmentSizeAndSunshineStats,
    type: :list
  )

  field(:solarPanelConfigs, as: GoogleApi.Solar.V1.Model.SolarPanelConfig, type: :list)
  field(:solarPanels, as: GoogleApi.Solar.V1.Model.SolarPanel, type: :list)
  field(:wholeRoofStats, as: GoogleApi.Solar.V1.Model.SizeAndSunshineStats)
end

defimpl Poison.Decoder, for: GoogleApi.Solar.V1.Model.SolarPotential do
  def decode(value, options) do
    GoogleApi.Solar.V1.Model.SolarPotential.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Solar.V1.Model.SolarPotential do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
